﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Acms.DatabaseTest.Helpers
{
    public static class SiteMapingHelpers
    {
        private static string SelectClause
        {
            get { return "select * from [acms].[SiteMappings]"; }
        }

        /*public static void SiteMapping_Add(this TestConnection source, int id, int siteID, string mappingName)
        {
            string sql = string.Format("set identity_insert [acms].[SiteMappings] on \n insert into [acms].[SiteMappings] ([Id], [SiteId], [MappingName]) values ({0}, {1}, '{2}') \n set identity_insert [acms].[SiteMappings] off", id, siteID, mappingName);
            source.Execute(sql);
        }*/

        public static Dictionary<string, object> SiteMapping_GetByID(this TestConnection source, int id)
        {
            string sql = string.Format("{0} where id = {1}", SelectClause, id);
            return source.ExecuteWithResults(sql).FirstOrDefault();
        }

        public static List<Dictionary<string, object>> SiteMapping_GetAll(this TestConnection source)
        {
            return source.ExecuteWithResults(SelectClause);
        }

    }
}
